import 'package:flustars/flustars.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_boost/flutter_boost.dart';

class OnePage extends StatefulWidget {
  final Map param;

  OnePage(this.param);

  @override
  State<StatefulWidget> createState() {
    return _OnePageState();
  }
}

class _OnePageState extends State<OnePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("OnePage"),
      ),
      body: Container(
        // flustars工具类
        width: ScreenUtil.getInstance().screenWidth,
        color: Colors.white,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(widget.param == null ? "One" : widget.param["one"]),
            RaisedButton(
                child: Text("调回Android界面"),
                onPressed: () {
                  FlutterBoost.singleton.open("url://nativePage",
                      urlParams: {"native": "调回Android界面"});
                }),
            RaisedButton(
                child: Text("关闭当前界面"),
                onPressed: () {
                  Navigator.of(context).pop();
                }),
          ],
        ),
      ),
    );
  }
}
